import { createBrowserRouter } from 'react-router-dom'
import App from '../App'
const router = createBrowserRouter([
  {
    path: "/",
    element: <App></App>,
    children: [
      {
        path: "home",
        lazy: async () => {
          const { default: Home } = await import("../pagh/home/Index");
          return { element: <Home></Home> };
        },
      },
      {
        path: "index",
        lazy: async () => {
          const { default: Index } = await import("../pagh/index/Index");
          return { element: <Index></Index> };
        },
      },
      {
        path: "order",
        lazy: async () => {
          const { default: Order } = await import("../pagh/order/Index");
          return { element: <Order></Order> };
        },
      },
      {
        path: "my",
        lazy: async () => {
          const { default: My } = await import("../pagh/my/Index");
          return { element: <My></My> };
        },
      },
    ],
  },
  {
    path: "/chepiao",
    lazy: async () => {
      const { default: Chepiao, loader } = await import(
        "../pagh/chepiao/Index"
      );
      return { element: <Chepiao></Chepiao>, loader };
    },
  },
  {
    path: "/xiangqing/:id",
    lazy: async () => {
      const { default: Xiangqing, loader } = await import("../pagh/xiangqing/Index");
      return { element: <Xiangqing></Xiangqing>, loader };
    },
  },
  {
    path: "/login",
    lazy: async () => {
      const { default: Login } = await import("../pagh/login/Index");
      return { element: <Login></Login> };
    },
  },
  {
    path: "*",
    lazy: async () => {
      const { default: Error } = await import("../pagh/404/Index");
      return { element: <Error></Error> };
    },
  },
]);
export default router